using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

using MicroFractal.iTunesBrowser.Core.Helper;


namespace MicroFractal.iTunesBrowser.Core.Data.ITunesDB
{
    public class ITunesDB
    {
        private MemoryStream _iTunesDBStream;
                
        public ITunesDB(MemoryStream file)
        {
            _iTunesDBStream = file;
        }

        public string Representation
        {
            get { return "mhbd"; }
        }

        private List<ITunesDataSet> _iTunesDataSets;
        public List<ITunesDataSet> ITunesDataSets
        {
            get
            {
                if (_iTunesDataSets == null)
                {
                    _iTunesDataSets = Data.ITunesDB.ITunesDataSet.GetItunesDataSets(ITunesHelper.GetMemoryStream(_iTunesDBStream,ITunesHelper.BytesToInt(_iTunesDBStream, 4,4)));
                }

                return _iTunesDataSets;
            }
        }      
    }
}
